package com.shi.entity;

import com.alibaba.fastjson.JSONObject;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;

import java.io.Serializable;

/**
 * poetry实体类
 * 
 * @author 
 *
 */
@Document(indexName = "test_index")
public class Shi implements Serializable {
	/***/
	@Id
	private Integer id; 
	/***/
	private Integer authorId;
	/***/
	@Field
	private String title; 
	/***/
	@Field
	private String content; 
	/***/
	@Field
	private String yunlvRule; 
	/***/
	@Field
	private String author;
	/**
	 * @Field
	 */
	private String dynasty; 
	/**
	 * 实例化
	 */
	public Shi() {
		super();
	}
	
	/**
	 * 将当前对象转换为JsonObject
	 * 
	 * @return
	 */
	public JSONObject toJson() {
		JSONObject result = new JSONObject();
		if (this.getId() != null) {
			result.put("id",this.getId());
		}
		if (this.getAuthorId() != null) {
			result.put("authorId",this.getAuthorId());
		}
		if (this.getTitle() != null) {
			result.put("title",this.getTitle());
		}
		if (this.getContent() != null) {
			result.put("content",this.getContent());
		}
		if (this.getYunlvRule() != null) {
			result.put("yunlvRule",this.getYunlvRule());
		}
		if (this.getAuthor() != null) {
			result.put("author",this.getAuthor());
		}
		if (this.getDynasty() != null) {
			result.put("dynasty",this.getDynasty());
		}
		return result;
	}
	
	
	/**
	 * 获取id
	 * 
	 * @return
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * 设置id
	 * 
	 * @param id
	 */
	public void setId(Integer id) {
		this.id = id;
	}
	
	/**
	 * 获取authorId
	 * 
	 * @return
	 */
	public Integer getAuthorId() {
		return authorId;
	}

	/**
	 * 设置authorId
	 * 
	 * @param authorId
	 */
	public void setAuthorId(Integer authorId) {
		this.authorId = authorId;
	}
	
	/**
	 * 获取title
	 * 
	 * @return
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * 设置title
	 * 
	 * @param title
	 */
	public void setTitle(String title) {
		this.title = title;
	}
	
	/**
	 * 获取content
	 * 
	 * @return
	 */
	public String getContent() {
		return content;
	}

	/**
	 * 设置content
	 * 
	 * @param content
	 */
	public void setContent(String content) {
		this.content = content;
	}
	
	/**
	 * 获取yunlvRule
	 * 
	 * @return
	 */
	public String getYunlvRule() {
		return yunlvRule;
	}

	/**
	 * 设置yunlvRule
	 * 
	 * @param yunlvRule
	 */
	public void setYunlvRule(String yunlvRule) {
		this.yunlvRule = yunlvRule;
	}
	
	/**
	 * 获取author
	 * 
	 * @return
	 */
	public String getAuthor() {
		return author;
	}

	/**
	 * 设置author
	 * 
	 * @param author
	 */
	public void setAuthor(String author) {
		this.author = author;
	}
	
	/**
	 * 获取dynasty
	 * 
	 * @return
	 */
	public String getDynasty() {
		return dynasty;
	}

	/**
	 * 设置dynasty
	 * 
	 * @param dynasty
	 */
	public void setDynasty(String dynasty) {
		this.dynasty = dynasty;
	}

	@Override
	public String toString() {
		return "Shi [id=" + id + " , authorId=" + authorId + " , title=" + title + " , content=" + content + " , yunlvRule=" + yunlvRule + " , author=" + author + " , dynasty=" + dynasty + "  ]";
	
	}
	
	
}
